package com.chushouya.order.constants;


import com.general.framework.core.enums.IEnum;
import com.general.framework.core.exception.Ex;
import com.general.framework.core.lang.Strings;

import java.util.Objects;

/**
 * 订单商品实拍图片位置
 */
public enum ImagePositionEnum implements IEnum<String> {
    top("top", "顶部照片", true, 1,"https://image.suhuishou.com/image-position/top.jpg"),
    bottom("bottom", "底部照片", true, 2,"https://image.suhuishou.com/image-position/bottom.jpg"),
    left("left", "左侧面照片", true, 3,"https://image.suhuishou.com/image-position/left.jpg"),
    right("right", "右侧面照片", true, 4,"https://image.suhuishou.com/image-position/right.jpg"),
    front("front", "正面照片", true, 5,"https://image.suhuishou.com/image-position/front.jpg"),
    back("back", "背面照片", true, 6,"https://image.suhuishou.com/image-position/back.jpg"),
    i4pic("i4pic", "爱思/沙漏照片", true, 10,"https://image.suhuishou.com/image-position/i4pic.jpg"),
//    imei("imei", "IMEI串码照片", false, 7,"https://image.suhuishou.com/image-position/imei.jpg"),
//    account("account", "云账号解锁图", false, 8,"https://image.suhuishou.com/image-position/account.jpg"),
    model("model", "机型信息照片", false, 9,"https://image.suhuishou.com/image-position/model.jpg"),
//    modelDetail("modelDetail", "机型详情照片", false, 10,"https://image.suhuishou.com/image-position/modelDetail.jpg");
    extend1("extend1", "瑕疵特写1", false, 20,"https://image.suhuishou.com/image-position/extend.jpg"),
    extend2("extend2", "瑕疵特写2", false, 21,"https://image.suhuishou.com/image-position/extend.jpg"),
    extend3("extend3", "瑕疵特写3", false, 22,"https://image.suhuishou.com/image-position/extend.jpg");
    private String value;

    private String desc;
    private boolean required;

    private int sort;
    private String exampleImage;



    ImagePositionEnum(String value, String desc, boolean required, int sort, String exampleImage) {
        this.value = value;
        this.desc = desc;
        this.required = required;
        this.sort = sort;
        this.exampleImage = exampleImage;
    }


    public static String getDesc(String value) {
        for (ImagePositionEnum thisEnum : ImagePositionEnum.values()) {
            if (Objects.equals(thisEnum.value, value)) {
                return thisEnum.desc;
            }
        }
        return Strings.EMPTY;
    }

    public static ImagePositionEnum get(String value) {
        for (ImagePositionEnum thisEnum : ImagePositionEnum.values()) {
            if (Objects.equals(thisEnum.value, value)) {
                return thisEnum;
            }
        }
        throw Ex.systemError("未定义的参数：{}", value);
    }

    @Override
    public String value() {
        return this.value;
    }

    @Override
    public String named() {
        return this.desc;
    }

    public boolean isRequired() {
        return required;
    }

    public int getSort() {
        return sort;
    }

    public String getExampleImage() {
        return exampleImage;
    }
}
